package cn.edu.thu.laud.extratools;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;

public class CassandraTokenCalcuate {

	 public static void main(String[] args) {
	       String input = null;
	       int nodeAmount = 0;
	       try {
	          System.out.print("Number of Cassandra Nodes: ");
	          BufferedReader is = new BufferedReader(new InputStreamReader(System.in));
	             input = is.readLine();
	             nodeAmount = Integer.parseInt(input);
	       }
	       catch (NumberFormatException ex) {
	          System.err.println("Not a valid number: " + input);
	       }
	       catch (IOException e) {
	          System.err.println("Unexpected IO ERROR: " + e);
	       }
	       BigInteger tok = new BigInteger("170141183460469231731687303715884105728");
	       for(int i=0; i<nodeAmount; i++){
	          System.out.println("Node: " + i);
	          System.out.println("initial_token: " + tok.multiply(BigInteger.valueOf(i)).divide(BigInteger.valueOf(nodeAmount)));
	       }
	 }
	}